﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VonaJobs.DAL.DAO;
using VonaJobs.DAL.Gatway;

namespace VonaJobs.BLL
{
    public class JobCategoryManager
    {
        JobCategoryGateway jobCategoryGateway = new JobCategoryGateway();
        public string SaveNewJobCategory(JobCategory jobCategory)
        {
            try
            {
                if (!HasThisJobCategory(jobCategory))
                {
                    return jobCategoryGateway.SaveJobCategory(jobCategory);
                }
                
            }
            catch (Exception)
            {
                
                throw;
            }
            return "Job category created successfully";
        }

        private bool HasThisJobCategory(JobCategory jobCategory)
        {
            try
            {
                return jobCategoryGateway.HasThisjobCategory(jobCategory);
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        public string UpdateJobCategory(JobCategory jobCategory)
        {
            try
            {
                return jobCategoryGateway.UpdateJobCategory(jobCategory);
            }
            catch (Exception)
            {
                
                throw;
            }
        }
    }
}